<?php
namespace app\home\controller\api;
use app\home\controller\Base;

class Api extends Base
{

	/**
	 * 会员状态接口
	 * @return [type] [description]
	 */
	public function member_status(){
		$params = $this->request->param();
		$statusId = isset($params['id'])?$params['id']:null;

		$data = model('member')::status($statusId);
		return json($data);
	}

	/**
	 * 是否代理中心
	 * @return [type] [description]
	 */
	public function member_is_agent(){
		$params = $this->request->param();
		$key = isset($params['id'])?$params['id']:null;

		$data = model('member')::is_agent($key);
		return json($data);
	}

	/**
	 * 会员大区
	 * @return [type] [description]
	 */
	public function member_area(){
		$params = $this->request->param();
		$key = isset($params['id'])?$params['id']:null;

		$data = model('member')::area($key);
		return json($data);
	}
	/**
	 * 会员类型
	 * @return [type] [description]
	 */
	public function member_type(){
		$params = $this->request->param();
		$key = isset($params['id'])?$params['id']:null;

		$data = model('member')::type($key);
		return json($data);
	}
	/**
	 * 手机验证状态
	 * @return [type] [description]
	 */
	public function member_is_phone_checked(){
		$params = $this->request->param();
		$key = isset($params['id'])?$params['id']:null;

		$data = model('member')::is_phone_checked($key);
		return json($data);
	}

	/**
     * 获取会员等级接口
     * @return [type] [description]
     */
    public function levels(){
        $params = $this->request->only(['id']);
        $id =isset($params['id'])?$params['id']:null;
        $data = model('level')::levelData($id);
        return json(['code'=>1,'data'=>$data]);
        //return json($data);
    }

    /**
	 * 地址接口
	 * @return [type] [description]
	 */
	public function city(){
		$params = $this->request->param();
		$id = isset($params['id'])?$params['id']:'001';
		$data = model('city')->findByParent($id);
		return json($data);
	}

	/**
	 * 货币类型
	 * @return [type] [description]
	 */
	public function coin_type(){
		$params = $this->request->only(['id']);
        $id = isset($params['id'])?$params['id']:null;

        $data = model('coin')::coinData($id);
        return json($data);
	}

}